Imports System.Windows.Forms
Imports dao
 Imports System.Data
Imports DTO
Public Class GIAOVIENBus
Inherits AbstractBus
 Public Sub New()
 End Sub
 Public Sub New(ByVal ConnectionString As KetNoiDto)
 ketnoi = ConnectionString
 End Sub
 #Region "Xử Lý" 
 Public Sub Them(ByVal Dto As GIAOVIENDto)
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.Them(Dto)
 End Sub
 Public Sub Xoa( ByVal IDGIAOVIEN As System.Int32)
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.xoa(IDGIAOVIEN)
 End Sub
 Public Sub sua(ByVal Dto As GIAOVIENDto)
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.sua(Dto)
 End Sub
 #End Region 
 Public Function LayBangTable() As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 dao.laybang()
 Return Dao
 End Function
 Public Function LayBangTableIlist() As IList
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoGIAOVIEN As GIAOVIENdto = LayBangDTo(i, Dao) 
 aList.Add(dtoGIAOVIEN)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableSQL(ByVal sql As string) As DataTable
 Dim Dao As New  AbstractDao(sql,sql,ketnoi)
 Return Dao
 End Function
 Public Sub suaMAGIAOVIEN( ByVal MAGIAOVIEN as System.String, ByVal IDGIAOVIEN As System.Int32 )
 Dim dao As New GIAOVIENDao(ketnoi)
 dao.suaMAGIAOVIEN(MAGIAOVIEN,IDGIAOVIEN)
 End Sub 
 Public Sub suaTENGIAOVIEN( ByVal TENGIAOVIEN as System.String, ByVal IDGIAOVIEN As System.Int32 )
 Dim dao As New GIAOVIENDao(ketnoi)
 dao.suaTENGIAOVIEN(TENGIAOVIEN,IDGIAOVIEN)
 End Sub 
 Public Sub suaGIOITINH( ByVal GIOITINH as System.Int32, ByVal IDGIAOVIEN As System.Int32 )
 Dim dao As New GIAOVIENDao(ketnoi)
 dao.suaGIOITINH(GIOITINH,IDGIAOVIEN)
 End Sub 
 Public Sub suaDIACHI( ByVal DIACHI as System.String, ByVal IDGIAOVIEN As System.Int32 )
 Dim dao As New GIAOVIENDao(ketnoi)
 dao.suaDIACHI(DIACHI,IDGIAOVIEN)
 End Sub 
 Public Sub suaSDT( ByVal SDT as System.String, ByVal IDGIAOVIEN As System.Int32 )
 Dim dao As New GIAOVIENDao(ketnoi)
 dao.suaSDT(SDT,IDGIAOVIEN)
 End Sub 
 Public Sub suaNGAYSINH( ByVal NGAYSINH as System.String, ByVal IDGIAOVIEN As System.Int32 )
 Dim dao As New GIAOVIENDao(ketnoi)
 dao.suaNGAYSINH(NGAYSINH,IDGIAOVIEN)
 End Sub 
 Public Sub suaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDGIAOVIEN As System.Int32 )
 Dim dao As New GIAOVIENDao(ketnoi)
 dao.suaTRANGTHAI(TRANGTHAI,IDGIAOVIEN)
 End Sub 
 Public Sub suaGHICHU( ByVal GHICHU as System.String, ByVal IDGIAOVIEN As System.Int32 )
 Dim dao As New GIAOVIENDao(ketnoi)
 dao.suaGHICHU(GHICHU,IDGIAOVIEN)
 End Sub 
 Public Function LayBangTable( ByVal IDGIAOVIEN As System.Int32) As DataTable
 Dim Dao As New GIAOVIENDao(IDGIAOVIEN,ketnoi)
 Return Dao
 End Function
 Public Function LayBangTableIlist( ByVal IDGIAOVIEN As System.Int32) As IList
 Dim Dao As New GIAOVIENDao(IDGIAOVIEN,ketnoi)
 Dim aList As New ArrayList 
 For i As Integer = 0 To Dao.Rows.Count - 1 
 Dim dtoGIAOVIEN As GIAOVIENdto = LayBangDTo(i, Dao) 
 aList.Add(dtoGIAOVIEN)
 Next 
 Return aList 
 End Function
 Public Function LayBangTableTheoIDGIAOVIEN (ByVal IDGIAOVIEN As System.Int32) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoIDGIAOVIEN(IDGIAOVIEN)
 Return Dao
 End Function
 Public Function LayBangTableTheoIDGIAOVIEN (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoIDGIAOVIEN(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoIDGIAOVIEN (ByVal IDGIAOVIEN As System.Int32) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoIDGIAOVIEN(IDGIAOVIEN)
 End sub
 Public Function LayBangTableTheoMAGIAOVIEN (ByVal MAGIAOVIEN As System.String) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoMAGIAOVIEN(MAGIAOVIEN)
 Return Dao
 End Function
 Public Function LayBangTableTheoMAGIAOVIEN_like (ByVal MAGIAOVIEN As System.String ) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoMAGIAOVIEN_like (MAGIAOVIEN)
 Return Dao
 End Function
 Public Function LayBangTableTheoMAGIAOVIEN (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoMAGIAOVIEN(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoMAGIAOVIEN (ByVal MAGIAOVIEN As System.String) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoMAGIAOVIEN(MAGIAOVIEN)
 End sub
 Public Function LayBangTableTheoTENGIAOVIEN (ByVal TENGIAOVIEN As System.String) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoTENGIAOVIEN(TENGIAOVIEN)
 Return Dao
 End Function
 Public Function LayBangTableTheoTENGIAOVIEN_like (ByVal TENGIAOVIEN As System.String ) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoTENGIAOVIEN_like (TENGIAOVIEN)
 Return Dao
 End Function
 Public Function LayBangTableTheoTENGIAOVIEN (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoTENGIAOVIEN(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoTENGIAOVIEN (ByVal TENGIAOVIEN As System.String) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoTENGIAOVIEN(TENGIAOVIEN)
 End sub
 Public Function LayBangTableTheoGIOITINH (ByVal GIOITINH As System.Int32) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoGIOITINH(GIOITINH)
 Return Dao
 End Function
 Public Function LayBangTableTheoGIOITINH (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoGIOITINH(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoGIOITINH (ByVal GIOITINH As System.Int32) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoGIOITINH(GIOITINH)
 End sub
 Public Function LayBangTableTheoDIACHI (ByVal DIACHI As System.String) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoDIACHI(DIACHI)
 Return Dao
 End Function
 Public Function LayBangTableTheoDIACHI_like (ByVal DIACHI As System.String ) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoDIACHI_like (DIACHI)
 Return Dao
 End Function
 Public Function LayBangTableTheoDIACHI (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoDIACHI(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoDIACHI (ByVal DIACHI As System.String) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoDIACHI(DIACHI)
 End sub
 Public Function LayBangTableTheoSDT (ByVal SDT As System.String) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoSDT(SDT)
 Return Dao
 End Function
 Public Function LayBangTableTheoSDT_like (ByVal SDT As System.String ) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoSDT_like (SDT)
 Return Dao
 End Function
 Public Function LayBangTableTheoSDT (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoSDT(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoSDT (ByVal SDT As System.String) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoSDT(SDT)
 End sub
 Public Function LayBangTableTheoNGAYSINH (ByVal NGAYSINH As System.String) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoNGAYSINH(NGAYSINH)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYSINH_like (ByVal NGAYSINH As System.String ) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoNGAYSINH_like (NGAYSINH)
 Return Dao
 End Function
 Public Function LayBangTableTheoNGAYSINH (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoNGAYSINH(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoNGAYSINH (ByVal NGAYSINH As System.String) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoNGAYSINH(NGAYSINH)
 End sub
 Public Function LayBangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(TRANGTHAI)
 Return Dao
 End Function
 Public Function LayBangTableTheoTRANGTHAI (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoTRANGTHAI(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoTRANGTHAI (ByVal TRANGTHAI As System.Int32) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoTRANGTHAI(TRANGTHAI)
 End sub
 Public Function LayBangTableTheoGHICHU (ByVal GHICHU As System.String) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoGHICHU(GHICHU)
 Return Dao
 End Function
 Public Function LayBangTableTheoGHICHU_like (ByVal GHICHU As System.String ) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoGHICHU_like (GHICHU)
 Return Dao
 End Function
 Public Function LayBangTableTheoGHICHU (ByVal ARRAY1 As ArrayList) As DataTable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangTheoGHICHU(ARRAY1)
 Return Dao
 End Function
 Public sub XOAbangTableTheoGHICHU (ByVal GHICHU As System.String) 
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.XOABangTheoGHICHU(GHICHU)
 End sub
 Public Function LayBangDTo( ByVal IDGIAOVIEN As System.Int32) As GIAOVIENdto
 Dim Dao As New GIAOVIENDao(IDGIAOVIEN, ketnoi)
 Dim dto As New GIAOVIENdto
 If Dao.Rows.Count<= 0 then Return dto
 Try
 If IsDBNull(Dao.Rows(0)("IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(0)("IDGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(0)("GIAOVIEN.IDGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("MAGIAOVIEN")) = False Then
 Dto.MAGIAOVIEN = Dao.Rows(0)("MAGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.MAGIAOVIEN")) = False Then
 Dto.MAGIAOVIEN = Dao.Rows(0)("GIAOVIEN.MAGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("TENGIAOVIEN")) = False Then
 Dto.TENGIAOVIEN = Dao.Rows(0)("TENGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.TENGIAOVIEN")) = False Then
 Dto.TENGIAOVIEN = Dao.Rows(0)("GIAOVIEN.TENGIAOVIEN")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIOITINH")) = False Then
 Dto.GIOITINH = Dao.Rows(0)("GIOITINH")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.GIOITINH")) = False Then
 Dto.GIOITINH = Dao.Rows(0)("GIAOVIEN.GIOITINH")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("DIACHI")) = False Then
 Dto.DIACHI = Dao.Rows(0)("DIACHI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.DIACHI")) = False Then
 Dto.DIACHI = Dao.Rows(0)("GIAOVIEN.DIACHI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("SDT")) = False Then
 Dto.SDT = Dao.Rows(0)("SDT")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.SDT")) = False Then
 Dto.SDT = Dao.Rows(0)("GIAOVIEN.SDT")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("NGAYSINH")) = False Then
 Dto.NGAYSINH = Dao.Rows(0)("NGAYSINH")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.NGAYSINH")) = False Then
 Dto.NGAYSINH = Dao.Rows(0)("GIAOVIEN.NGAYSINH")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(0)("GIAOVIEN.TRANGTHAI")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("GHICHU")
 End if
Catch ex As Exception
End Try
 Try
 If IsDBNull(Dao.Rows(0)("GIAOVIEN.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(0)("GIAOVIEN.GHICHU")
 End if
Catch ex As Exception
End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal i As Integer, ByVal dao As DataTable) As GIAOVIENdto
 Dim dto As New GIAOVIENdto
 If Dao.Rows.Count<=0 then Return dto
 Try
 If IsDBNull(Dao.Rows(i)("IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(i)("IDGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.IDGIAOVIEN")) = False Then
 Dto.IDGIAOVIEN = Dao.Rows(i)("GIAOVIEN.IDGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("MAGIAOVIEN")) = False Then
 Dto.MAGIAOVIEN = Dao.Rows(i)("MAGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.MAGIAOVIEN")) = False Then
 Dto.MAGIAOVIEN = Dao.Rows(i)("GIAOVIEN.MAGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("TENGIAOVIEN")) = False Then
 Dto.TENGIAOVIEN = Dao.Rows(i)("TENGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.TENGIAOVIEN")) = False Then
 Dto.TENGIAOVIEN = Dao.Rows(i)("GIAOVIEN.TENGIAOVIEN")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIOITINH")) = False Then
 Dto.GIOITINH = Dao.Rows(i)("GIOITINH")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.GIOITINH")) = False Then
 Dto.GIOITINH = Dao.Rows(i)("GIAOVIEN.GIOITINH")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("DIACHI")) = False Then
 Dto.DIACHI = Dao.Rows(i)("DIACHI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.DIACHI")) = False Then
 Dto.DIACHI = Dao.Rows(i)("GIAOVIEN.DIACHI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("SDT")) = False Then
 Dto.SDT = Dao.Rows(i)("SDT")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.SDT")) = False Then
 Dto.SDT = Dao.Rows(i)("GIAOVIEN.SDT")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("NGAYSINH")) = False Then
 Dto.NGAYSINH = Dao.Rows(i)("NGAYSINH")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.NGAYSINH")) = False Then
 Dto.NGAYSINH = Dao.Rows(i)("GIAOVIEN.NGAYSINH")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.TRANGTHAI")) = False Then
 Dto.TRANGTHAI = Dao.Rows(i)("GIAOVIEN.TRANGTHAI")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("GHICHU")
 End if
 Catch ex As Exception
 End Try
 Try
 If IsDBNull(Dao.Rows(i)("GIAOVIEN.GHICHU")) = False Then
 Dto.GHICHU = Dao.Rows(i)("GIAOVIEN.GHICHU")
 End if
 Catch ex As Exception
 End Try
 Return dto
 end function
 Public Function LayBangDTo(ByVal dong As Integer, ByVal dao As DataGridView) As GIAOVIENdto
 Dim dto As New GIAOVIENdto
 If dao.Rows.Count <= 0 Then Return dto
 For cot As Integer = 0 To dao.Columns.Count - 1
 Try
 Dto.HoTro(dao.Columns(cot).DataPropertyName, dao.Item(cot, dong).Value)
 Catch ex As Exception
 End Try
 Next
 Return Dto
 End Function
 Public Function layBangNhieuTable() as Datatable
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.layBangNhieuTable()
 Return Dao
 End Function
 Public Sub Taotable()
 Dim Dao As New GIAOVIENDao(ketnoi)
 Dao.TaoTable()
 End Sub
 End Class

